import json
import os

filename = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


def read_other_json():
    with open(os.path.join(filename, "data", "other.json"), "r", encoding="utf-8") as f:
        return json.load(f)


def extract_login_info(data):
    if "login" not in data:
        print("错误：数据中不包含login信息")
        return None

    login_info = data["login"]
    return [(
        login_info.get("url_code", ""),
        login_info.get("url", ""),
        login_info.get("accounts", ""),
        login_info.get("pwd", ""),
        login_info.get("login_type", ""),
        login_info.get("status_code", 0),
        login_info.get("msg", "")
    )]
